package test_modele;

import static org.junit.Assert.*;

import org.junit.Before;
import org.junit.Test;

import modele.Album;
/**
 * 
 * @author Plancq Charlotte, Lanvin Kévin, Darras Raphael
 *
 *
 */
public class TAlbum {
	Album a,b,c,d,e;
	@Before
	public void setUp(){
		a = new Album("Tintin au Tibet", "Hergé", "editeur", "aventure", "Tintin", "synopsis", 5, " "," ");
		b= new Album("Nitnit au Tebit","Géher",null,"l'Aaaaaventura","Nitnit","resumé", 6, "abcd"," ");
		c=new Album("Tintin au Tibet", "Hergé", "editeur", "aventure", "Tintin", "synopsis", 0, null,null);
		d = new Album("Tintin","",null,null,null,null,0,null,null);
		e = new Album("salut","",null,null,null,null,0,null,null);
	}
	
	@Test
	public void testGetters(){
		assertEquals("Tintin au Tibet", a.getTitre());
		assertEquals("Hergé", a.getAuteur());
		assertEquals("editeur",a.getEditeur());
		assertEquals("aventure", a.getGenre());
		assertEquals("Tintin", a.getSerie());
		assertEquals("synopsis",a.getSynopsis());
		assertEquals(" ",a.getCommentaire());
		assertEquals(5,a.getNote());
		assertEquals(" ", a.getImage());
	}

	public void testSetters(){
		b.setTitre("Tintin au Tibet");
		b.setAuteur("hergé");
		b.setEditeur("editeur");
		b.setGenre("aventure");
		b.setSerie("Tintin");
		b.setSynopsis("synopsis");
		b.setCommentaire(" ");
		b.setNote(6);
		assertEquals("Tintin au Tibet", b.getTitre());
		assertEquals("Hergé", b.getAuteur());
		assertEquals("editeur", b.getEditeur());
		assertEquals("aventure", b.getGenre());
		assertEquals("Tintin", b.getSerie());
		assertEquals("synopsis", b.getSynopsis());
		assertEquals(" ",b.getCommentaire());
		assertEquals(5,b.getNote());
	}



	@Test
	public void test_contains() {
		assertTrue(a.contains("Hergé"));
		assertFalse(a.contains("bibi"));
	}

	@Test
	public void testCorrespond(){
		assertTrue(a.correspond(c));
		assertFalse(a.correspond(b));
		assertFalse(d.correspond(e));
	}
	
	public void testToString(){
		assertEquals("Tintin au Tibet", a.toString());
	}
}
